home *** CD-ROM | disk | FTP | other *** search
- #define TRUE 1
- #define FALSE 0
-
- typedef unsigned char bool;
- /*
- typedef unsigned char byte;
- typedef unsigned short word;
- */
- extern void com_putc( int c );
- extern int com_putc_now( int c );
- extern void com_write(char *buf, int bytes);
- extern void com_wait(void);
- extern int com_getchar(void);
- extern int com_peek(void);
- extern int com_char_avail(void);
- extern bool com_out_empty(void);
- extern bool com_online(void);
- extern void com_clear_out(void);
- extern void com_clear_in(void);
- extern void com_XON_enable(void);
- extern void com_XON_disable(void);
- extern long com_cur_baud(void );
- extern int com_init(int port, char *pipe);
- extern int com_fini(void);
- extern int com_set_baud(long rate,char parity,int databits,int stopbits);
- extern void com_DTR_on(void );
- extern void com_DTR_off(void );
- extern void com_break(int on);
-
- extern void MDM_ENABLE(int ignore);
- extern void MDM_DISABLE(void );
- extern void BUFFER_BYTE(unsigned char ch);
- extern void UNBUFFER_BYTES(void );
- static void zap_zbuf(void );
- extern int Cominit(int port);
- extern int get_key(void);
-
- /* translate binkley fossil stuff to my async package */
- #define CARRIER (com_online())
- #define CHAR_AVAIL() com_char_avail()
- #define OUT_EMPTY() com_out_empty()
- #define OUT_FULL() (!com_out_empty())
- #define DTR_OFF() com_DTR_off()
- #define DTR_ON() com_DTR_on()
- #define CLEAR_OUTBOUND() com_clear_out()
- #define CLEAR_INBOUND() com_clear_in()
- #define KEYPRESS() kbhit()
- #define READKB() get_key()
- #define FOSSIL_CHAR() get_key()
- #define XON_ENABLE() com_XON_enable()
- #define IN_XON_ENABLE() com_XON_enable()
- #define XON_DISABLE() com_XON_disable()
- #define _BRK_DISABLE()
- #define FOSSIL_WATCHDOG(x)
- #define SENDBYTE(c) com_putc(c)
- /*#define BUFFER_BYTE(c) com_putc(c)*/
- /*#define UNBUFFER_BYTES() com_wait() */
- #define MODEM_IN() com_getchar()
- #define WRITE_ANSI(c) putchar(c)
- #define PEEKBYTE() com_peek()
- #define do_break(on) com_break(on)
- #define SENDCHARS(buf, size, carcheck) com_write(buf, size)
- #define Com_Tx_NW(c) com_putc_now(c)
-
- #define real_flush(fh) DosBufReset(fh)
-
- /* some usefull bits */
- #define RLSD 0x80 /* (MSR) Received line signal detect,
- * sometimes called Carrier Detect */
- #define THRE 0x20 /* (LSR) Transmitter holding register empty
- * (ready for another byte) */
- #define DR 0x1 /* (LSR) Data ready indicator */
- #define OE 0x2 /* (LSR) Overrun error! We are not reading the
- * bytes fast enuf */
-
- #if defined(OS2_INCLUDED)
-
- /* OS/2 Category 1 DosDevIoctl() calls */
- #define SERIAL 1 /* category: serial device control */
- #define ASYNC_SETBAUDRATE 0x41 /* Sets baud rate */
- #define ASYNC_SETLINECTRL 0x42 /* Sets line characteristics for serial device */
- #define ASYNC_TRANSMITIMM 0x44 /* Transmits byte immediately */
- #define ASYNC_SETBREAKOFF 0x45 /* Sets break off */
- #define ASYNC_SETMODEMCTRL 0x46 /* Sets modem control register */
- #define ASYNC_STOPTRANSMIT 0x47 /* Stops device from transmitting */
- #define ASYNC_STARTTRANSMIT 0x48 /* Starts a transmission */
- #define ASYNC_SETBREAKON 0x4b /* Sets break on */
- #define ASYNC_SETDCBINFO 0x53 /* Sets device control block information */
- #define ASYNC_GETBAUDRATE 0x61 /* Retrieves current baud rate */
- #define ASYNC_GETLINECTRL 0x62 /* Gets line characterstics of serial device */
- #define ASYNC_GETCOMMSTATUS 0x64 /* Retrieves communications status */
- #define ASYNC_GETLINESTATUS 0x65 /* Retrieves current line status */
- #define ASYNC_GETMODEMOUTPUT 0x66 /* Retrieves modem-control output signals */
- #define ASYNC_GETMODEMINPUT 0x67 /* Retrieves modem control register */
- #define ASYNC_GETINQUECOUNT 0x68 /* Retrieves number of characters in input queue */
- #define ASYNC_GETOUTQUECOUNT 0x69 /* Retrieves number of characters in output q */
- #define ASYNC_GETCOMMERROR 0x6d /* Retrieves communications error */
- #define ASYNC_GETCOMMEVENT 0x72 /* Retrieves communications event mask */
- #define ASYNC_GETDCBINFO 0x73 /* Retrieves device control block information */
-
- #define GENERIC 11 /* category: generic device control commands */
- #define FLUSHINPUT 1 /* function: flush input buffer */
- #define FLUSHOUTPUT 2 /* function: flush output buffer */
-
- typedef struct _DCBINFO {
- USHORT usWriteTimeout;
- USHORT usReadTimeout;
- BYTE bFlags1;
- BYTE bFlags2;
- BYTE bFlags3;
- BYTE bErrorReplacementChar;
- BYTE bBreakReplacementChar;
- BYTE bXONChar;
- BYTE bXOFFChar;
- } DCBINFO;
-
- typedef struct _RXQUEUE {
- USHORT cbChars;
- USHORT cbQueue;
- } RXQUEUE;
-
- #endif